const tools = {
  formatBody: (status, message, data) => {
    return {
      status,
      message: message ? message : (status === 1 ? '处理成功' : '处理失败'),
      data: data ? data : {}
    }
  },
  sleep: time => {
    return new Promise((resolve, reject) => {
      setTimeout(resolve, time)
    })
  }
}

module.exports = tools
